package Game;

import static org.lwjgl.opengl.GL11.*;

public class Cube extends GameObject{
	public float w, h, d;
	
	public Cube(float x, float y , float z) {
		super(x, y, z);
	}
	
	@Override
	public void Update(long diftime) {
		
	}
	
	@Override
	public void Render() {
		draw();
	}

	public void draw() {
		glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
		glPushMatrix();
		{
			glBegin(GL_QUADS);
			{
				//face cara
				glNormal3f(x-w/2, y-h/2, z-d/2);
				glVertex3d(x-w/2, y-h/2, z-d/2);
				
				glNormal3f(x+w/2, y-h/2, z-d/2);
				glVertex3d(x+w/2, y-h/2, z-d/2);
				
				glNormal3f(x+w/2, y+h/2, z-d/2);
				glVertex3d(x+w/2, y+h/2, z-d/2);
				
				glNormal3f(x-w/2, y+h/2, z-d/2);
				glVertex3d(x-w/2, y+h/2, z-d/2);
				
				
				//face traz
				glNormal3f(x-w/2, y-2/2, z+d/2);
				glVertex3d(x-w/2, y-2/2, z+d/2);
				
				glNormal3f(x+w/2, y-h/2, z+d/2);
				glVertex3d(x+w/2, y-h/2, z+d/2);
				
				glNormal3f(x+w/2, y+h/2, z+d/2);
				glVertex3d(x+w/2, y+h/2, z+d/2);
				
				glNormal3f(x-w/2, y+h/2, z+d/2);
				glVertex3d(x-w/2, y+h/2, z+d/2);

				//face esquerda
				glNormal3f(x+w/2, y-h/2, z+d/2);
				glVertex3d(x+w/2, y-h/2, z+d/2);

				glNormal3f(x+w/2, y-h/2, z+d/2);
				glVertex3d(x+w/2, y-h/2, z+d/2);
				
				glNormal3f(x+w/2, y+h/2, z-d/2);
				glVertex3d(x+w/2, y+h/2, z-d/2);
				
				glNormal3f(x+w/2, y+h/2, z-d/2);
				glVertex3d(x+w/2, y+h/2, z-d/2);
			
				
				//face direita
				glNormal3f(x-w/2, y-h/2, z+d/2);
				glVertex3d(x-w/2, y-h/2, z+d/2);
				
				glNormal3f(x-w/2, y-h/2, z+d/2);
				glVertex3d(x-w/2, y-h/2, z+d/2);
				
				glNormal3f(x-w/2, y+h/2, z-d/2);
				glVertex3d(x-w/2, y+h/2, z-d/2);
				
				glNormal3f(x-w/2, y+h/2, z-d/2);
				glVertex3d(x-w/2, y+h/2, z-d/2);
			}
		}
			glEnd();
		glPopMatrix();
	}
}
